from typing import AsyncIterator, Any

import scrapy


class CengciSpider(scrapy.Spider):
    name = "cengci"

    # allowed_domains = ["quotes.toscrape.com"]
    # start_urls = ["https://quotes.toscrape.com"]
    async def start(self):
        yield scrapy.FormRequest(
            "http://httpbin.org/post",
            formdata={
                "ssss": "474",
            },
            cb_kwargs={"sss": "747"},
            meta={
                "ddd": 4545,
            },
        )

    def parse(self, response, sss):
        print(f'mete为{response.meta["ddd"]}')
        print(response.json())
        yield scrapy.FormRequest(
            "http://httpbin.org/post",
            formdata={"origin": response.json()["origin"]},
            callback=self.parse_ll,
            cb_kwargs={
                "www": 989,
            },
        )

    def parse_ll(self, response, www):
        print(response.json()["origin"])
        print(www)
